#!/usr/bin/env python3
"""
沃尔玛产品上传工具启动脚本
"""
import os
import sys
import tkinter as tk
import traceback

# 添加当前目录到系统路径
current_dir = os.path.dirname(os.path.abspath(__file__))
parent_dir = os.path.dirname(current_dir)
sys.path.append(current_dir)
sys.path.append(parent_dir)

try:
    # 尝试导入需要的库
    import requests
    import pandas
    
    # 直接从当前目录导入
    from walmart_api import WalmartAPI
    from walmart_uploader_gui import WalmartUploaderApp
    
    # 启动GUI
    root = tk.Tk()
    app = WalmartUploaderApp(root)
    print("启动沃尔玛产品上传工具...")
    root.mainloop()
    
except ImportError as e:
    print(f"错误: 缺少必要的库 - {e}")
    print("请使用以下命令安装所需库:")
    print("pip install requests pandas")
    input("按Enter键退出...")
    
except Exception as e:
    print(f"启动时出现错误: {e}")
    print(f"错误详情: {str(e)}")
    traceback.print_exc()
    input("按Enter键退出...") 